<div class="hbox hbox-auto-xs hbox-auto-sm" ng-init="
    app.settings.asideFolded = false;
    app.settings.asideDock = false;">
    <!-- main -->
    <div class="col">
        <!-- main header -->
        <div class="bg-light lter b-b wrapper-md">
            <div class="row">
                <div class="col-sm-6 col-xs-12" ng-controller="ansibleVersionCtrl">
                    <h1 class="m-n font-thin h3 text-black">Ansible Task
                        <button ng-click="ansibleVersion()"
                                class="btn btn-xs"
                                style="margin-left: 5px; background-color: #00a8f3; color: white;">
                            <span class="icon icon-info"></span> Version
                        </button>
                    </h1>
                    <small class="text-muted">服务器批量运维</small>
                </div>
            </div>
        </div>
        <!-- / main header -->
        <div class="wrapper-md">

            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>

            <div class="hbox hbox-auto-xs hbox-auto-sm" ng-controller="serverplaybookCtrl">

                <div class="panel panel-default">
                    <div class="panel-body">
                        <form class="form-inline" role="form">
                            <div class="form-group">
                                <div class="input-group">
                                    <span class="input-group-addon">服务器组名称</span>
                                    <input type="text" class="form-control" ng-model="queryName"
                                           placeholder="名称">
                                </div>
                            </div>
                            <div class="form-group">
                                <button type="button" class="btn btn-info" ng-click="queryGroupTree()"><span
                                        class="glyphicon glyphicon-search"></span>搜索
                                </button>
                            </div>
                        </form>

                        <div class="b-a bg-light dk r r-2x col-md-6" style="margin-top: 5px;">
                            <span ng-if="doing_async">...查询中...</span>
                            <abn-tree
                                    tree-data="my_data"
                                    tree-control="my_tree"
                                    on-select="my_tree_handler(branch)"
                                    expand-level="2"
                                    initial-selection="Granny Smith"
                                    icon-leaf="icon icon-screen-desktop"
                                    icon-expand="fa fa-plus"
                                    icon-collapse="fa fa-minus">
                            </abn-tree>
                        </div>

                        <div class="col-md-6" style="margin-top: 5px;">

                            <div class="alert alert-info" ng-if="hostPatternSelected.hostPattern != null && hostPatternSelected.hostPattern != ''">
                                {{hostPatternSelected.hostPattern}}
                                <button ng-click="addGroup()"
                                        class="btn btn-xs pull-right" uib-popover-html="'加入任务列表'"
                                        popover-trigger="'mouseenter'"
                                        style="margin-left: 5px; background-color: #20a03f; color: white;">
                                    <span class="glyphicon glyphicon-plus"></span>加入
                                </button>
                            </div>

                            <form class="form-horizontal" style="box-shadow: 0 0 5px #ddd;padding: 10px;">
                                <div ng-include="'tpl/modal/servertask/serverplaybook_hostpattern.html'"></div>
                            </form>

                            <div class="form-group" style="margin-top: 5px;">
                                <div class="col-md-12">
                                    <label class="col-lg-2 control-label" style="margin-top: 5px;"><span
                                            style="color: #ec2121;">*</span>PLAYBOOK</label>
                                    <div class="col-lg-6">
                                        <!--ng-change="changeServerGroup()"-->
                                        <ui-select ng-model="nowTaskScript.selected" theme="bootstrap">
                                            <ui-select-match placeholder="搜索Playbook名称......">
                                                {{$select.selected.scriptName }}
                                            </ui-select-match>
                                            <ui-select-choices refresh="queryTaskScript($select.search)"
                                                               refresh-dalay="0"
                                                               repeat="item in taskScriptList | filter: $select.search">
                                                <div ng-bind-html="item.scriptName | highlight: $select.search"></div>
                                            </ui-select-choices>
                                        </ui-select>
                                    </div>

                                    <div class="col-lg-4" style="margin-top: 5px;">
                                        <button ng-click="viewScript()"
                                                class="btn btn-xs"
                                                style="margin-left: 5px; background-color: #00a8f3; color: white;">
                                            <span class="glyphicon glyphicon-search"></span>查看
                                        </button>
                                        <button class="btn btn-xs"
                                                style="background-color: #c9302c; color: white;"
                                                ng-click="doPlaybook()" ng-disabled="btnDoScript">
                                            <i class="fa fa-play"></i>执行
                                        </button>
                                    </div>
                                </div>

                                <div class="col-md-12" style="margin-top: 5px;">
                                    <label class="col-lg-2 control-label" style="margin-top: 5px;">外部变量</label>
                                    <div class="col-lg-10">
                                        <input type="text" class="form-control" placeholder="-e EXTRA_VARS,例子:name=bob age=30"
                                               ng-model="extraVars">
                                    </div>
                                </div>

                                <div class="col-md-12" style="margin-top: 5px;">
                                    <label class="col-lg-2 control-label" style="margin-top: 5px;">参数</label>
                                    <div class="col-lg-10">
                                        <input type="text" class="form-control" placeholder="可选参数"
                                               ng-model="params">
                                    </div>
                                </div>


                            </div>
                        </div>

                        <!--任务详情-->
                        <form class="form-horizontal col-md-12" style="box-shadow: 0 0 5px #ddd;padding: 10px;margin-top: 10px;">
                            <div ng-include="'tpl/modal/servertask/serverplaybook_result.html'"></div>
                        </form>

                    </div>


                </div>


            </div>


        </div>
    </div>
    <!-- / main -->
</div>


<script type="text/ng-template" id="versionInfoModal">
    <div ng-include="'tpl/modal/ansible_version_info_modal.html'"></div>
</script>


<script type="text/ng-template" id="scriptInfoModal">
    <div ng-include="'tpl/modal/script_info_modal.html'"></div>
</script>


<script type="text/ng-template" id="serverInfo">
    <div ng-include="'tpl/modal/server_info_modal.html'"></div>
</script>

<script type="text/ng-template" id="serverpsInfo">
    <div ng-include="'tpl/modal/serverpg_modal.html'"></div>
</script>